<?php
    echo Modules::run('ndh/header');
?>
<div class="clear" style="padding-bottom: 5px;"></div>   
        <div id="mainContent" style="width: 987px;">
            <table width="987" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                <tr valign="top">
                    <td>
                        <div id="leftContent" style="background-color: #FFFFFF;">
                        <table align="center" width="100%" cellpadding="0" cellspacing="0" border="1">
                        <?php
                            if(isset($news))
                            {
                                $i = 0;      
                                foreach($news as $k => $value)
                                {
                                    $style = ($i % 2 == 0) ? 'style="background-color: #FFFFFF;"' : 'style="background-color: #F6F6F6;"';                     
                        ?>
                         
                          <tr valign="middle" <?php echo $style; ?> >
                                <td height="25" style="padding-left: 5px" width="80%"><a href="<?php echo base_url(); ?>uploads/company/report/<?php echo $value['upload'] ?>" target="blank"><?php echo $value['title'];?></a></td>
                                <td width="20%" align="center">
                                    <a href="<?php echo base_url(); ?>uploads/company/report/<?php echo $value['upload'] ?>" target="blank">
                                        <img width="16" height="16" src="<?php echo base_url(); ?>/images/<?php echo $value['filetype'] ?>" alt="">
                                    </a>
                                </td>
                            </tr>
                        
                        <?php
                                    $i++;
                                }
                            }
                        ?>
                        </table>
                        </div>
                    </td>
                    <td><div id="rightContent" style="height: auto;">
                <!-- index table -->
                <div id="indextbl">Index</div>
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">
                <?php 
                require_once "simple_html_dom.php";
                $url = "http://www.bloomberg.com/";
                $html = file_get_html($url);

                $us = $html->find('div[id=market_snap_us]',0)->outertext;
                $europe = $html->find('div[id=market_snap_europe]',0)->outertext;
                $asia = $html->find('div[id=market_snap_asia]',0)->outertext;
                ?>
                    <ul>
                        <li><a id="US" href="#">Mỹ</a></li>
                        <li><a id="Europe" href="#">Châu Âu</a></li>
                        <li><a id="Asia" href="#">Châu Á</a></li>
                    </ul>
                    <br/>
                    <div id="indexUS">
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$us); ?> 
                    </div>
                    <div id="indexEurope" style="display: none;"> 
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$europe); ?>
                    </div>
                    <div id="indexAsia" style="display: none;">
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$asia); ?>
                    </div>
                    <script>          
                       $("#US").click(function() {
                          $('#indexUS').show('slow');
                          $('#indexEurope').hide();
                          $('#indexAsia').hide();
                        });
                         
                       $("#Europe").click(function() {
                          $('#indexEurope').show('slow');
                          $('#indexUS').hide();
                          $('#indexAsia').hide();
                        });

                       $("#Asia").click(function() {
                          $('#indexAsia').show('slow');
                          $('#indexEurope').hide();
                          $('#indexUS').hide();
                        });
                    </script>
                    <br/>
                </div>
                <!-- index table -->
                
                <br/>
                <!-- nha dau tu -->
                <div id="indextbl">Nhà đầu tư</div>  
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">
                <table id="nhadautu" border="1" width="100%" style="background-color: #FFFFFF;">
                    <tr style="height: 24px;" align="center">
                        <td colspan="3" width="50%" style="border-right: 1px solid #CCCCCC;">NDT NƯỚC NGOÀI</td>
                        <td colspan="3" width="50%">NDT TRONG NƯỚC</td>
                    </tr>
                    <tr style="height: 24px;" align="center">
                        <th>&nbsp;</th>
                        <th>Mua</th>
                        <th>Bán</th>
                        <th>&nbsp;</th>
                        <th>Mua</th>
                        <th>Bán</th>
                    </tr>                    
                    <tr>
                    <?php
                            foreach( $investor_foreign as $investor )
                            {
                    ?>
                        <td class="alt3"><?php echo $investor['name'] ?></td><td class="alt2"><?php echo $investor['buy'] ?></td><td class="alt2"><?php echo $investor['sell'] ?></td>
                        <?php
                            }
                        ?>
                    </tr>
                    <tr>
                        <?php
                            foreach( $investor_data as $investor )
                            {
                        ?>
                        <td class="alt3"><?php echo $investor['name'] ?></td><td class="alt2"><?php echo $investor['buy'] ?></td><td class="alt2"><?php echo $investor['sell'] ?></td>
                        <?php
                            }
                        ?>
                    </tr>
                
                </table>
                </div>
                <!-- nha dau tu -->
                <br/>
                <!-- bao cao phan tich -->
                <div id="indextbl">BÁO CÁO PHÂN TÍCH</div>  
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">                    
                    <?php
                        foreach($analyze_reports as $report)
                        {
                    ?>
                        <p>&raquo; <a href="<?php echo base_url(); ?>uploads/company/report/<?php echo $report['upload'] ?>" target="blank" class="normalNews"><?php echo $report['title'] ?></a></p>            
                    <?php
                        }
                    ?>
                </div>
                <!-- bao cao phan tich -->
            </div></td>
                </tr>
            </table>
        </div>
        <div class="clear" style="height: 2px; background-color: #FFFFFF; width: 987;"></div>
<?php
    echo Modules::run('ndh/footer');
?>